<template>
  <el-form :model="formData" label-width="120px" ref="form" v-loading="loading" class="pr-4">
    <el-form-item label="生成数量" prop="count">
      <el-input-number v-model="formData.count" :min="1" :max="1000" clearable />
    </el-form-item>
    <el-form-item label="箱号类型" prop="box_type">
      <el-select v-model="formData.box_type"  placeholder="选择箱号类型">
        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
      </el-select>
    </el-form-item>
    <div class="flex justify-end">
      <el-button type="primary" @click="submitForm(form)">{{ $t('system.confirm') }}</el-button>
    </div>
  </el-form>
</template>

<script lang="ts" setup>
import { useCreate } from '/admin/composables/curd/useCreate'
import { useShow } from '/admin/composables/curd/useShow'
import { onMounted,ref } from 'vue'
import http from '/admin/support/http'

const props = defineProps({
  primary: String | Number,
  api: String,
})

const options = ref([
  {
    value:'1',
    label:'普通箱号'
  },
  {
    value:'2',
    label:'周转箱号'
  }
])

const { formData, form, loading, submitForm, close } = useCreate(props.api, props.primary)

if (props.primary) {
  // useShow(props.api, props.primary, formData)
// let supplierObj = reactive({})

  // const getList = () => {
  // console.log('请求供应商送货')

  // http.get(`/purchasing/codenumber/${props.primary}?codenumber=supplier `).then(r => {
  //   let res = r.data.data
  //   console.log('供应商送货', res)
  //   supplierObj = res
  // })
// }

// getList()
}

formData.value.box_type = "1"
formData.value.count = 1

const emit = defineEmits(['close'])







onMounted(() => {
  close(() => emit('close'))
})
</script>

<style lang="css" scoped>
  .el-form-item {
    margin: 20px 0;
  }
</style>